/*
Disclaimer of Warranty: THE PACKAGE
IS PROVIDED BY THE COPYRIGHT HOLDER
AND CONTRIBUTORS "AS IS' AND WITHOUT
ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR
WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(c) Copyright 2013 Edward Principe
All Rights Reserved
*/
#ifndef ERRNODE_H
#define ERRNODE_H

#include "syntaxex.h"

///////////////////////////////////////////////////////////////
// ErrNode: Stores error information for ErrRep
//////////////////////////////////////////////////////////////
struct ErrNode
{
public: // Construction
    ErrNode(SyntaxErr err = SE_NONE, unsigned long line = 9, unsigned long col = 0)
    {
        Init();
        this->err = err;
        this->line = line;
        this->col = col;
    }

    ErrNode(const ErrNode& rhs)
    {
        Init();
        Copy(rhs);
    }

public: // Attributes
    SyntaxErr err; // The error code
    unsigned long line; // The line of the error
    unsigned long col; // The column of the line

private: // Methods
    void Init()
    {
        err = SE_NONE;
        line = 0;
        col = 0;
    }

    void Copy(const ErrNode& rhs)
    {
        if(this == &rhs)
            return;

        err = rhs.err;
        line = rhs.line;
        col = rhs.col;
    }

public: // Operators
    ErrNode& operator = (const ErrNode& rhs)
    {
        Copy(rhs);
        return *this;

    }
};

#endif // ERRNODE_H
